<?php
/**
 *    过滤器
 * 对所有数据进行必要的过滤
 * 
 * 过滤数据包括  _GET _POST _REQUEST _COOKIE
 * 
 * ·字符级编码
 * ·SQL安全
 * ·安全字符过滤
 * ·
 */

/**
 * 所有扩扩展滤镜必须实现功能 *
 */
interface ExtFilter{
	public function todo();
	public function setData(&$data);
}

class _Filter {
	//待过滤数据
	private $FilterData;
	const configFile = "./xml/filter.xml";
	private $xmlObject;
	private $filterObj = array();
	
	public function __construct(){
		$this->xmlObject = simplexml_load_file(self::configFile);
		if('object' != gettype($this->xmlObject)){
			return 0;
		}
		$mapNode = &$this->xmlObject->body->map;
		$filterCount = count($mapNode);
		for($i=0;$i<$filterCount;$i++){
			$loadClass = $this->xmlObject->body->map[$i]->obj;
			_importClass($loadClass);
			$class  = $this->xmlObject->body->map[$i]->execobj;
			if(class_exists($class))eval("\$this->filterObj[] = new $class();");
		}
	}
	
	public function __destruct(){
		/* @var $GO_RES _CNRES*/
	}
	
		
	public function gFilter($idx=-1){
		$rv = "";
		if($idx!=-1){
			$rv = $this->filterObj[$idx];
		}
		else{
			$rv = $this->filterObj;
		}
		return $rv;
	}
}

return md5(__FILE__);